package com.cskaoyan.controller.wechat;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.mall.Region;
import com.cskaoyan.bean.mall.RegionExample;
import com.cskaoyan.mapper.RegionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dengww
 * @create 2020/5/5 7:33
 */
@RestController
@RequestMapping("wx/region")
public class WxRegionController {
    @Autowired
    RegionMapper regionMapper;

    @GetMapping("list")
    public BaseRespVo getRegionList(Integer pid) {
        RegionExample regionExample =new RegionExample();
        RegionExample.Criteria criteria = regionExample.createCriteria();
        criteria.andPidEqualTo(pid);
        List<Region> regions = regionMapper.selectByExample(regionExample);
        return new BaseRespVo(0, regions, "成功");
    }
}
